// src/store/loadAdjustment.js
import { defineStore } from "pinia";

export const useLoadAdjustmentStore = defineStore("loadAdjustment", {
  state: () => ({
    // 步骤一完成状态
    isStepOneCompleted: false,
    // 步骤二完成状态
    isStepTwoCompleted: false,
    // 是否正在调节负载
    isAdjusting: false,
  }),

  getters: {
    // 获取步骤一完成状态
    getStepOneStatus: (state) => state.isStepOneCompleted,
    // 获取步骤二完成状态
    getStepTwoStatus: (state) => state.isStepTwoCompleted,
    // 获取调节状态
    getAdjustingStatus: (state) => state.isAdjusting,
  },

  actions: {
    // 设置步骤一为已完成
    completeStepOne() {
      this.isStepOneCompleted = true;
    },

    // 设置步骤二为已完成
    completeStepTwo() {
      this.isStepTwoCompleted = true;
    },

    // 设置调节状态
    setAdjustingStatus(status) {
      this.isAdjusting = status;
    },

    // 重置所有步骤状态
    resetAllSteps() {
      this.isStepOneCompleted = false;
      this.isStepTwoCompleted = false;
      this.isAdjusting = false;
    },
  },
});